<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:83:"D:\Software\phpstudy_pro\WWW\asks\public/../application/admin\view\config\list.html";i:1636338554;s:73:"D:\Software\phpstudy_pro\WWW\asks\application\admin\view\common\meta.html";i:1639278409;s:75:"D:\Software\phpstudy_pro\WWW\asks\application\admin\view\common\script.html";i:1635431232;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <!-- 样式 -->
    <meta charset="UTF-8">
<title><?php echo $system['siteAdminName']; ?></title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
    content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<meta http-equiv="Cache-Control" content="no-siteapp" />

<link rel="shortcut icon" href="<?php echo $system['siteAdminLogo']; ?>" type="image/x-icon" />
<link rel="stylesheet" href="\static\admin\css/font.css">
<link rel="stylesheet" href="\static\admin\css/xadmin.css">
    <!-- js文件 -->
    <script src="\static\admin\js/jquery.min.js"></script>
<script src="\static\admin\lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="\static\admin\js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body>
    <div class="x-nav">
        <span class="layui-breadcrumb">
            <a>
                <cite>首页</cite>
            </a>
            <a>
                <cite>网站配置</cite>
            </a>
            <a>
                <cite>配置列表</cite></a>
        </span>
        <a class="layui-btn layui-btn-primary layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
            href="javascript:location.replace(location.href);" title="刷新">
            <i class="layui-icon" style="line-height:38px">ဂ</i></a>
    </div>
    <div class="x-body">
        <div class="layui-row">
            <form class="layui-form layui-col-md12 x-so">
                <input type="text" name="username" placeholder="请输入用户名" autocomplete="off" class="layui-input">
                <button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            </form>
        </div>
        <xblock>
            <button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
            <!-- <a href="<?php echo url('admin/config/add'); ?>" class="layui-btn"><i class="layui-icon"></i>添加</a> -->
            <span class="x-right" style="line-height:40px">共有数据:<?php echo $count; ?>条</span>
        </xblock>
        <table class="layui-table">

            <thead>
                <tr>
                    <th>
                        <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i
                                class="layui-icon">&#xe605;</i></div>
                    </th>
                    <th>ID</th>
                    <th>配置标题</th>
                    <th>配置名称</th>
                    <th>配置的值</th>
                    <th>配置选项的类型</th>
                    <th>操作</th>
            </thead>
            <tbody>
                <?php foreach($config as $v): ?>
                <tr>
                    <td>
                        <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='<?php echo $v['id']; ?>'><i
                                class="layui-icon">&#xe605;</i></div>
                    </td>
                    <td><?php echo $v['id']; ?></td>
                    <td><?php echo $v['title']; ?></td>
                    <td><?php echo $v['key']; ?></td>
                    <?php if($v['type'] == 'text'): ?>
                    <td><?php echo $v['value']; ?></td>
                    <td>文本类型</td>
                    <?php else: ?>
                    <td>
                        <a href="<?php echo $v['value']; ?>" target="__blank">
                            <img src="<?php echo $v['value']; ?>" alt="">
                        </a>
                    </td>
                    <td>文件类型</td>
                    <?php endif; ?>
                    <td class="td-manage">
                        <a title="编辑" href="<?php echo url('admin/config/edit',['id'=>$v['id']]); ?>">
                            <i class="layui-icon">&#xe642;</i>
                        </a>
                        <a title="删除" onclick="member_del('<?php echo $v['id']; ?>')" href="javascript:;">
                            <i class="layui-icon">&#xe640;</i>
                        </a>
                    </td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        <div class="page">
            <?php echo $config->render(); ?>
        </div>
    </div>
    <script>




        /*用户-删除*/
        function member_del(id) {
            layer.confirm('确认要删除吗？', function (index) {

                // 发异步删除数据
                $.ajax({
                    url: `<?php echo url('admin/config/delete'); ?>`,
                    type: 'post',
                    data: {
                        'id': id,
                    },
                    dataType: 'json',
                    success: function (res) {
                        if (res.code == 1) {
                            layer.msg('已删除!', { icon: 1, time: 1000 }, function () {
                                location.reload();
                            });
                        } else {
                            layer.msg('删除失败!', { icon: 1, time: 1000 }, function () {
                                location.reload();
                            });
                        }
                    }
                })
            });
        }

        function delAll(argument) {
            var data = tableCheck.getData();
            data = data.join(',');
            member_del(data);
        }
    </script>
</body>

</html>